import http from '../../utils/httpRequest'

export default {
  queryBaseAttrByCondition (currentPage = 1, size = 10, attrObj) {
    return http({
      url: `/pms/attr/list/${currentPage}/${size}`,
      method: 'post',
      data: attrObj
    })
  },

  getAttrByAttrId (attrId) {
    return http({
      url: `/pms/attr/info/${attrId}`,
      method: 'get'
    })
  },

  updateValueSelectByAttrId (attrId, valueSelect) {
    return http({
      url: `/pms/attr/update`,
      method: 'post',
      data: {
        // "attrGroupId": 0,
        // "attrGroupName": "string",
        attrId,
        // "attrName": "string",
        // "attrSort": 0,
        // "attrType": 0,
        // "categoryName": "string",
        // "catelogId": 0,
        // "enable": 0,
        // "icon": "string",
        // "searchType": 0,
        // "selectMultiple": true,
        // "showDesc": 0,
        valueSelect,
      }
    })
  },
  /**
   * 根据categoryId或者attrType来获取属性，因为销售属性没有绑定属性分组，所以只能直接来这里查询
   * */
  getAttrByCategoryIdAndCondition (categoryId, attrType) {
    return http({
      url: `/pms/attr/getAttrByCategoryIdAndCondition/${categoryId}`,
      method: 'post',
      data: {
        // "attrId": 0,
        // "attrName": "string",
        attrType,
        // "catelogId": 0,
        // "enable": 0,
        // "icon": "string",
        // "searchType": 0,
        // "selectMultiple": true,
        // "showDesc": 0,
        // "valueSelect": "string"
      }
    })
  }
}
